package Day06;

import java.util.Scanner;
//实现登录验证，有 3 次机会，如果用户名为"丁真" ,密码"666"提示登录成功，
//否则提示还有几次机会，请使用 for+break 完
public class Demo18 {
    public static void main(String[] args) {
        Scanner in =new Scanner(System.in);
        String name = "";
        String password = "";
        int i = 3;//机会
        for (int j = 1; j <=3 ; j++) {
            System.out.println("请您输入名字：");
            name = in.next();
            System.out.println("请您输入密码：");
            password = in.next();
            if("丁真".equals(name)&&"666".equals(password)){
                System.out.println("登陆成功!");
                break;
            }
            i--;
            System.out.println("您还有"+i+"次机会");
        }

    }
}
